#!/bin/sh -e

export GOPATH="$PWD/gopath"
export GOFLAGS="$GOFLAGS -mod=vendor"
trap "go clean -modcache" EXIT INT

go run build.go -no-upgrade -version "v$2" build

clinst -Dm755 syncthing "$1/usr/bin/syncthing"

# Install manual pages.
clman -d "$1" man/*.[0-9]
